package com.etc.singleton;


/**
 * 单例模式1 ->饿汉
 */
public class Singleton1 {
    //2 类加载直接构造对象,但是会加载比较慢,饿汉模式
    private static Singleton1 instance = new Singleton1();
    //1 构造方法私有化
    private Singleton1() {
    }

    //3 创建一个静态方法,返回的是Singleton1的实例
    public static Singleton1 getInstance() {
        return instance;
    }
}
